<?php
/**
 * 获取首次病程记录
 * Created by PhpStorm.
 * User: zhang-hong
 * Date: 2017/3/8
 * Time: 14:01
 */
class GetbingchengjilushoucidataController extends Yaf_Controller_Abstract
{
    function IndexAction()
    {
        $request = $this->getRequest();
        $zhuyuan_id = $request->getPost("zhuyuan_id","");
        $yiyuan_id = $request->getPost("yiyuan_id","");
        $zhuyuanbingchengshouciModel = new ZhuyuanBingchengJiluShouciModel();
        if(!ctype_digit("$yiyuan_id"))
        {
            Utility::apiJsonError(20027, '医院ID必须是整型');
        }
        if(!$zhuyuan_id)
        {
            Utility::apiJsonError(20014, '住院ID不能为空');
        }

        $zhuyuan_bingchengjilushouci = $zhuyuanbingchengshouciModel->getZhuYuanBasicInfo($zhuyuan_id,$yiyuan_id);
        if(empty($zhuyuan_id) ||empty($zhuyuan_bingchengjilushouci)|| (is_array($zhuyuan_bingchengjilushouci)&&count($zhuyuan_bingchengjilushouci)==0))
        {
            $data["state"] = "0";
        }
        else
        {
            $data["state"] = "1";
            foreach ($zhuyuan_bingchengjilushouci as $key => $one_bingchengjilushouci)
            {
                $one_bingchengjilushouci =  strip_tags($one_bingchengjilushouci);
                $one_bingchengjilushouci =  trim($one_bingchengjilushouci);
                $one_bingchengjilushouci =  str_replace("&nbsp;", " ", $one_bingchengjilushouci);
                $zhuyuan_bingchengjilushouci[$key] =  $one_bingchengjilushouci;
            }
            $data["result"] = $zhuyuan_bingchengjilushouci;
        }
        $data['error'] = 200;
        $data['msg'] = "";
        Utility::apiJsonResultExtends($data);
        //$compression_http_data = $_REQUEST["compression_http_data"];
        //Utility::apiJsonResult($data,"",$compression_http_data);
    }
}